/*********************************************************************************
  *Copyright (c)    2021   xldeng
  *FileName:        logTest.cc.c
  *Author:          xldeng
  *Version:         1.0
  *Date:            2021/2/25 10:10
  *Description:     
  *Others:          
  *Function List:   
     1.…………
  *History:  
     1.Date:
       Author:
       Modification:
**********************************************************************************/
#include "log.h"
#include "util.h"
#include <iostream>

int main() {
    sylar::Logger::ptr logger(new sylar::Logger("newlogger"));
    sylar::LogAppender::ptr file_appender(new sylar::FileLogAppender("./logfile.txt"));
    sylar::LogAppender::ptr error_logfile_appender(new sylar::FileLogAppender("./error_logfile.txt"));
    file_appender->setLevel(sylar::LogLevel::DEBUG);
    error_logfile_appender->setLevel(sylar::LogLevel::ERROR);
    logger->addAppender(file_appender);
    logger->addAppender(error_logfile_appender);
//    SYLAR_LOG_DEBUG(logger) << "debug";
//    SYLAR_LOG_INFO(logger) << "info";
//    SYLAR_LOG_WARN(logger) << "warn";
//    SYLAR_LOG_ERROR(logger) << "error";
//    SYLAR_LOG_FATAL(logger) << "fatal";
//    SYLAR_LOG_FMT_ERROR(logger, "test macro fmt error %s", "aa");

    auto loggerXX = SYLAR_LOG_NAME("xx");
    loggerXX->setLevel(sylar::LogLevel::INFO);
    loggerXX->addAppender(sylar::LogAppender::ptr(new sylar::FileLogAppender("./test.txt")));
    auto loggerXX1 = sylar::LoggerMgr::GetInstance()->getLogger("xx");


    SYLAR_LOG_INFO(loggerXX) << "xx";
    SYLAR_LOG_INFO(loggerXX1) << "xx1";

    return 0;
}
